home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format CD 46
/
Amiga Format CD46 (1999-10-20)(Future Publishing)(GB)[!][issue 1999-12].iso
/
-in_the_mag-
/
reader_requests
/
scilab
/
demos
/
npend
/
npend.dem
< prev
next >
Wrap
Text File
|
1999-09-16
|
1KB
|
50 lines
tt=0:0.05:10;
//tt=0:0.1:1;
path="SCI/demos/npend";
mode(-1);
getf(path+'/macros.sci','c');
getf(path+'/dessin.sci','c');
xbasc();
flag1=x_choose(['Read a precomputed trajectory';
'Simulation with ode (needs f77 and link. may fail. see help link)'],...
'Simulation or Visualisation ? (click below)');
select flag1,
case 2 then host("cd $"+path+"; make ");
if ~c_link('npend') then link('/tmp/npend.o','npend');end
if ~c_link('ener') then link('/tmp/ener.o','ener');end
if ~c_link('np') then link('/tmp/np.o','np');end
n=np();
r=1*ones(1,n);m=1*ones(1,n);j=1*ones(1,n);g=9.81;
y0=0*ones(2*n,1);
yt=ode(y0,0,tt,'npend');
xselect();
xbasc();
chaina(yt);
flag=2 ;
y=[]; for i=1:n;y=[y;'theta'+string(i)];end
yd=[]; for i=1:n;yd=[yd;'thetad'+string(i)];end
ystr=[y;yd];
while flag=2, [n1,n2]=size(yt);
flag=x_choose(['Stop';'Go on'],'Choose');
if flag=2,y0=evstr(x_mdialog(['Initial point '],ystr,...
string(yt(:,n2))));
yt=ode(y0,0,tt,'npend');
met=x_choose(['With last point trajectory';'Without'],...
'Graphic Option');
xbasc();
if met=1; chainb(yt);else;chaina(yt);end
end
end
case 1 then // A precomputed value for
//x0=[0;%pi/2+0.1;0;5.0;0.0;4.0;0;0];
n=10;
r=1*ones(1,n);m=1*ones(1,n);j=1*ones(1,n);g=9.81;
y0=0*ones(2*n,1);
yt=read(path+'/yt.wrt',20,201);
chaina(yt);
end